﻿package mortal.game.scene3D.model.player
{
    import baseEngine.basic.*;
    import baseEngine.core.*;
    import baseEngine.system.*;
    import frEngine.core.*;
    import frEngine.core.mesh.*;
    import mortal.game.resource.*;
    import mortal.game.scene3D.layer3D.utils.*;

    public class MeshPlayer extends NormalMesh3D implements IGame2D, IHang
    {
        private var _y2d:Number = 0;
        private var _x2d:Number = 0;
        private var _hangBoneName:String;
        private var _direction:Number = 0;
        private var _selectEnabled:Boolean = false;
        protected var _textTure:String;

        public function MeshPlayer()
        {
            super(null);
            this.material.materialParams.colorKillvalue = 0;
            this.setMateiralBlendMode(EBlendType.BLEND_NONE);
            return;
        }// end function

        public function play(param1:int = 0) : void
        {
            return;
        }// end function

        public function set selectEnabled(param1:Boolean) : void
        {
            this._selectEnabled = param1;
            return;
        }// end function

        public function get selectEnabled() : Boolean
        {
            return this._selectEnabled;
        }// end function

        override public function dispose(param1:Boolean = true) : void
        {
            this._x2d = 0;
            this._y2d = 0;
            this._hangBoneName = null;
            this._direction = 0;
            this._textTure = null;
            this.selectEnabled = false;
            super.dispose(param1);
            return;
        }// end function

        public function load(param1:String, param2:String, param3:RenderList = null) : void
        {
            var _loc_4:Boolean = false;
            var _loc_5:int = 0;
            if (param3 == null)
            {
                param3 = Global3D.scene.renderLayerList;
            }
            renderList = param3;
            if (!Global3D.loadResource)
            {
                return;
            }
            if (this._meshUrl != param1)
            {
                disposeSurfaces();
                this.meshUrl = param1;
            }
            if (this._textTure != param2)
            {
                _loc_4 = Resource3dKilAlpha.instance.isJpg(param2);
                _loc_5 = BlendTypeConfig.instance.getBlendType(param2);
                this.setBlendModeAndKillAlpha(!_loc_4, 0.5, _loc_5);
                this._textTure = param2;
                this.setMaterial(param2, Texture3D.MIP_NONE, param2);
            }
            return;
        }// end function

        public function set direction(param1:Number) : void
        {
            this._direction = param1;
            this.setRotation(0, Scene3DUtil.change2Dto3DRotation(this._direction), 0);
            return;
        }// end function

        public function get direction() : Number
        {
            return this._direction;
        }// end function

        public function get hangBody() : Pivot3D
        {
            return this;
        }// end function

        public function get hangBoneName() : String
        {
            return this._hangBoneName;
        }// end function

        public function set hangBoneName(param1:String) : void
        {
            this._hangBoneName = param1;
            return;
        }// end function

        public function set x2d(param1:Number) : void
        {
            this._x2d = param1;
            x = Scene3DUtil.change2Dto3DX(param1);
            return;
        }// end function

        public function get x2d() : Number
        {
            return this._x2d;
        }// end function

        public function set y2d(param1:Number) : void
        {
            this._y2d = param1;
            z = Scene3DUtil.change2Dto3DY(param1);
            return;
        }// end function

        public function get y2d() : Number
        {
            return this._y2d;
        }// end function

    }
}
